package com.fsl.springbootexception.controller;

import com.fsl.springbootexception.exception.IllegalPropertiesException;
import com.fsl.springbootexception.exception.NullOrEmptyException;
import com.fsl.springbootexception.exception.SessionNotFoundException;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author sj2
 */
@RestController
public class UserController {

    @GetMapping("/user/{param}")
    public ResponseEntity<?> save(@PathVariable String param) throws Exception {
        if("a".equals(param)){
            throw new IllegalPropertiesException();
        }
        if("b".equals(param)){
            throw new SessionNotFoundException();
        }
        if("c".equals(param)){
            throw new NullOrEmptyException();
        }
        return ResponseEntity.ok("Successful");
    }
}
